package edu.fudan.jwxt.dao;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.fudan.jwxt.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface  UserDao extends BaseMapper<User>{

    @Select("select * from user where identity_id = #{identityId}")
    User selectByIdentityId(String identityId);

    @Update("update user set password = #{password} where uid = #{uid}")
    int updatePassword(String uid,String password);

    @Update("update user set name=#{name},phone=#{phone},email=#{email} where uid = #{uid}")
    int updateUserByPerson(User user);

    @Update("update user set name=#{name},phone=#{phone},email=#{email},identity_id = #{identityId},status=#{status},major_id=#{majorId},college_id=#{collegeId} where uid = #{uid}")
    int updateUserByAdmin(User user);

    @Update("update user set status = #{status} where uid = #{uid}")
    int updateStatus(User user);

}
